﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Syndication;

namespace YahooFinance
{
    /// <summary>
    /// An object that is responsible for remote API requests against Yahoo Finance
    /// </summary>
    public class News
    {
        INewsDataService rssNewsDataService = new YahooRssNewsDataService();

        /// <summary>
        /// Returns a list of news items for the given symbol
        /// </summary>
        /// <param name="symbol">The exchange symbol</param>
        /// <returns></returns>
        public IEnumerable<NewsItem> GetNewsForSymbol(string symbol)
        {
            IEnumerable<NewsItem> feed = rssNewsDataService.GetNewsItemsFromSource(symbol);
            if (feed == null) return null;
            return feed;
        }
    }
}
